package com.good.serviceImp;

import java.util.concurrent.Future;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import com.good.service.AsyncService;
@Service("asyncServiceImpl")
public class AsyncServiceImpl implements AsyncService {
	@Async
	public void test1(){
		System.out.println(Thread.currentThread().getName()+"test1");
	}
	@Async
	public void test2(){
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("test2");
	}
	@Async
	public Future<String> test3() {
		System.out.println(Thread.currentThread().getName()+"========test3");
		return new AsyncResult<String>("hello i am async result");
	}
}
